home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / sphigs / sph_srgp.lha / srgp / examples / MAC_show_patterns.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-09  |  1.4 KB  |  74 lines

  1. #include "HEADERS.h"
  2. #include "srgp.h"
  3. #ifdef THINK_C
  4. #include <unix.h>
  5. #endif
  6.  
  7. #define chipwidth 20
  8. #define chipheight 20
  9. #define vertmarg 5
  10. #define horizmarg 27
  11.  
  12. #define heightofcanvas0  400
  13.  
  14. int i, x, y;
  15. int whichdev;
  16. char str[10];   
  17.  
  18. attribute_group bund;
  19.  
  20. unsigned short redi, greeni, bluei;
  21.  
  22.  
  23. static void ShowPat (int num, char *numstr)
  24. {
  25.    SRGP_setFillBitmapPattern (num);
  26.    SRGP_fillRectangleCoord (x, y, x + chipwidth, y + chipheight);
  27.    SRGP_text (SRGP_defPoint(x + chipwidth+4, y+8), numstr);
  28.    y = y + chipheight+vertmarg;
  29. }
  30.  
  31. main()
  32. {
  33.    SRGP_begin ("SRGP Patterns", 600,heightofcanvas0, 2, FALSE);
  34.    SRGP_text (SRGP_defPoint(5, heightofcanvas0-15),
  35.           "Drawn in black in REPLACE mode.  Color use demonstrated on far right.");
  36.  
  37.    x = 5;
  38.    y = 5;
  39.  
  40. #ifdef THINK_C
  41.    SRGP_loadFont (0, "Monaco.9");
  42. #endif
  43.  
  44.    SRGP_setFillStyle (BITMAP_PATTERN_OPAQUE);
  45.  
  46.    for (i=0; i<=104; i++) {
  47.       sprintf (str, "%2d", i);
  48.       ShowPat(i, str);
  49.       if (y > (heightofcanvas0-40)) {
  50.      y = 5;
  51.      x = x + chipwidth + horizmarg;
  52.       }
  53.    }
  54.  
  55.    SRGP_loadCommonColor (2, "red");
  56.    SRGP_loadCommonColor (3, "green");
  57.    
  58.    SRGP_setColor (2);
  59.    SRGP_setBackgroundColor (3);
  60.  
  61.    y = 5;
  62.    x = x + chipwidth + horizmarg;
  63.  
  64.    for (i=0; i<=35; i++) {
  65.       sprintf (str, "%2d", i);
  66.       ShowPat(i, str);
  67.       if (y > (heightofcanvas0-40)) {
  68.      y = 5;
  69.      x = x + chipwidth + horizmarg;
  70.       }
  71.    }
  72.    SRGP_waitEvent (INDEFINITE);
  73. }
  74.